﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace LambdaToSql.Interface
{
    /// <summary>
    /// 删除接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IDeleteable<T> where T : class, new()
    {
        /// <summary>
        /// 数据库上下文对象
        /// </summary>
        LambdaToSql.EntityModel.DbContext Context { get; set; }

        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        IDeleteable<T> Delete(T obj);

        /// <summary>
        /// 条件删除
        /// </summary>
        /// <param name="expression"></param>
        /// <returns></returns>
        IDeleteable<T> Where(Expression<Func<T, bool>> expression);

        /// <summary>
        /// 执行删除 返回影响的行数
        /// </summary>
        /// <returns></returns>
        int ExecuteNonQuery();

        /// <summary>
        /// 执行删除 返回debug信息
        /// </summary>
        /// <returns></returns>
        LambdaToSql.EntityModel.Result<int> ExecuteNonQuery(bool debug);
    }
}
